function fileReaderUtility(str_Filename){ 
        try{
           var obj_File = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
           obj_File.initWithPath(str_Filename);
 
           var obj_InputStream =  Components.classes["@mozilla.org/network/file-input-stream;1"].createInstance(Components.interfaces.nsIFileInputStream);
           obj_InputStream.init(obj_File,0x01,0444,null);
	   obj_InputStream.QueryInterface(Components.interfaces.nsISeekableStream);
 
           var obj_ScriptableIO = Components.classes["@mozilla.org/binaryinputstream;1"].createInstance(Components.interfaces.nsIBinaryInputStream);
           obj_ScriptableIO.setInputStream(obj_InputStream);
        } catch (e) { alert(e); }
 	
	this.fileobject=obj_File;
	this.inputstream=obj_InputStream;
	this.binarystream=obj_ScriptableIO;
}

fileReaderUtility.prototype.fclose=function() {
	this.binarystream.close();
	this.inputstream.close();
}

fileReaderUtility.prototype.ftell=function() {
	return this.inputstream.tell();
}

fileReaderUtility.prototype.fseek=function(pos) {
	this.inputstream.seek(0,pos);
}

fileReaderUtility.prototype.fgetc=function() {
	return this.binarystream.read8();
}

fileReaderUtility.prototype.fget16be=function() {
	return ((this.fgetc()<<8)|(this.fgetc()));
}

fileReaderUtility.prototype.fget32be=function() {
	return (((((this.fgetc()*256)+this.fgetc())*256+this.fgetc())*256)+this.fgetc());
}

fileReaderUtility.prototype.fgets=function() {
	rstr="";
	while((rchr=this.binarystream.read8()) !=0){
		rstr=rstr+String.fromCharCode(rchr);
	}
	return rstr;
}

fileReaderUtility.prototype.fgetsl=function(len) {
	rstr="";
	for(var i=0;i<len;i++){
		rstr=rstr+String.fromCharCode(this.binarystream.read8());
	}
	return rstr;
}

fileReaderUtility.prototype.feof=function() {
	return (this.inputstream.tell()>=(this.fileobject.fileSize-1)?false:true);
}